cmake_minimum_required(VERSION 3.7.0)
project(zlog)
aux_source_directory(./ SRCS)
add_library(${PROJECT_NAME}
zlog.cpp
logqueue.hpp
datacollector.cc
datacollector.hh
diagconfig.h
diagecode.h
diagosapi.cpp
diagosapi.h
)
target_link_libraries(${PROJECT_NAME}
PRIVATE spdlog
jkutil
)

add_custom_command(
    OUTPUT diagecode.h
    COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/gen_ecode_header.py
    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/.diagecode.h
        ${CMAKE_CURRENT_SOURCE_DIR}/diagecode.h
    COMMAND rm ${CMAKE_CURRENT_SOURCE_DIR}/.diagecode.h
)

add_subdirectory(test)